<?php /* Smarty version 2.6.26, created on 2012-05-12 14:39:47
         compiled from controllers%5Clistings.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('function', 'rlHook', 'controllers\\listings.tpl', 10, false),array('modifier', 'cat', 'controllers\\listings.tpl', 41, false),array('modifier', 'is_array', 'controllers\\listings.tpl', 54, false),array('modifier', 'replace', 'controllers\\listings.tpl', 282, false),array('modifier', 'count', 'controllers\\listings.tpl', 460, false),array('modifier', 'date_format', 'controllers\\listings.tpl', 1008, false),array('modifier', 'in_array', 'controllers\\listings.tpl', 1051, false),)), $this); ?>
<!-- listings tpl -->

<?php if (! $this->_tpl_vars['deny']): ?>

	<script type="text/javascript" src="<?php echo @RL_LIBS_URL; ?>
jquery/jquery.qtip.js"></script>
	<script type="text/javascript">flynax.qtip();</script>
	
	<!-- navigation bar -->
	<div id="nav_bar">
		<?php echo rlHook::load(array('name' => 'apTplListingsNavBar'), $this);?>

	
		<?php if ($_GET['action'] == 'photos'): ?>
			<a href="<?php echo $this->_tpl_vars['rlBase']; ?>
index.php?controller=<?php echo $_GET['controller']; ?>
&amp;action=video&amp;id=<?php echo $_GET['id']; ?>
" class="button_bar"><span class="left"></span><span class="center_video"><?php echo $this->_tpl_vars['lang']['manage_video']; ?>
</span><span class="right"></span></a>
		<?php endif; ?>
		
		<?php if (! isset ( $_GET['action'] )): ?>
			<a href="javascript:void(0)" onclick="show('filters', '#action_blocks div');" class="button_bar"><span class="left"></span><span class="center_search"><?php echo $this->_tpl_vars['lang']['filters']; ?>
</span><span class="right"></span></a>
		<?php endif; ?>
		
		<?php if ($_GET['action'] == 'video'): ?>
			<a href="<?php echo $this->_tpl_vars['rlBase']; ?>
index.php?controller=<?php echo $_GET['controller']; ?>
&amp;action=photos&amp;id=<?php echo $_GET['id']; ?>
" class="button_bar"><span class="left"></span><span class="center_photo"><?php echo $this->_tpl_vars['lang']['manage_photos']; ?>
</span><span class="right"></span></a>
		<?php endif; ?>
		
		<?php if ($this->_tpl_vars['aRights'][$this->_tpl_vars['cKey']]['add'] && ! isset ( $_GET['action'] )): ?>
			<a href="javascript:void(0)" onclick="show('new_listing', '#action_blocks div');" class="button_bar"><span class="left"></span><span class="center_add"><?php echo $this->_tpl_vars['lang']['add_listing']; ?>
</span><span class="right"></span></a>
		<?php endif; ?>
		
		<?php if ($_GET['action'] == 'view'): ?>
			<a href="<?php echo $this->_tpl_vars['rlBase']; ?>
index.php?controller=<?php echo $_GET['controller']; ?>
&amp;action=edit&amp;id=<?php echo $this->_tpl_vars['listing_data']['ID']; ?>
" class="button_bar"><span class="left"></span><span class="center_edit"><?php echo $this->_tpl_vars['lang']['edit_listing']; ?>
</span><span class="right"></span></a>
		<?php endif; ?>
		
		<a href="<?php echo $this->_tpl_vars['rlBase']; ?>
index.php?controller=<?php echo $_GET['controller']; ?>
" class="button_bar"><span class="left"></span><span class="center_list"><?php echo $this->_tpl_vars['lang']['listings_list']; ?>
</span><span class="right"></span></a>
	</div>
	<!-- navigation bar end -->
	
	<div id="action_blocks">
	
		<?php if (! isset ( $_GET['action'] )): ?>
			<!-- filters -->
			<div id="filters" class="hide">
				<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_start.tpl') : smarty_modifier_cat($_tmp, 'm_block_start.tpl')), 'smarty_include_vars' => array('block_caption' => $this->_tpl_vars['lang']['filter_by'])));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
				
				<table>
				<tr>
					<td valign="top">
						<table class="form">
						<?php $_from = $this->_tpl_vars['filters']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['field'] => $this->_tpl_vars['filter']):
?>
						<tr>
							<td class="name w130"><?php echo $this->_tpl_vars['filter']['phrase']; ?>
</td>
							<td class="field">
								<select class="filters w200" id="<?php echo $this->_tpl_vars['field']; ?>
">
								<option value="">- <?php echo $this->_tpl_vars['lang']['all']; ?>
 -</option>
								<?php $_from = $this->_tpl_vars['filter']['items']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['value'] => $this->_tpl_vars['item']):
?>
									<option <?php if ($this->_tpl_vars['item']['type']): ?>id="option_<?php echo $this->_tpl_vars['item']['type']; ?>
_<?php echo $this->_tpl_vars['value']; ?>
"<?php endif; ?> <?php if (((is_array($_tmp=$this->_tpl_vars['item'])) ? $this->_run_mod_handler('is_array', true, $_tmp) : is_array($_tmp)) && $this->_tpl_vars['item']['margin']): ?><?php if ($this->_tpl_vars['item']['margin'] == 5): ?>class="highlight_opt"<?php endif; ?> style="margin-left: <?php echo $this->_tpl_vars['item']['margin']; ?>
px;"<?php endif; ?>value="<?php echo $this->_tpl_vars['value']; ?>
" <?php if (isset ( $this->_tpl_vars['status'] ) && $this->_tpl_vars['field'] == 'Status' && $this->_tpl_vars['value'] == $this->_tpl_vars['status']): ?>selected="selected"<?php endif; ?>><?php if (((is_array($_tmp=$this->_tpl_vars['item'])) ? $this->_run_mod_handler('is_array', true, $_tmp) : is_array($_tmp))): ?><?php echo $this->_tpl_vars['item']['name']; ?>
<?php else: ?><?php echo $this->_tpl_vars['item']; ?>
<?php endif; ?></option>
								<?php endforeach; endif; unset($_from); ?>
								</select>
							</td>
						</tr>
						<?php endforeach; endif; unset($_from); ?>
											
						<tr>
							<td></td>
							<td class="field">
								<input type="button" class="button" value="<?php echo $this->_tpl_vars['lang']['filter']; ?>
" id="filter_button" />
								<input type="button" class="button" value="<?php echo $this->_tpl_vars['lang']['reset']; ?>
" id="reset_filter_button" />
								<a class="cancel" href="javascript:void(0)" onclick="show('filters')"><?php echo $this->_tpl_vars['lang']['cancel']; ?>
</a>
							</td>
						</tr>
						</table>
					</td>
					<td style="width: 50px;"></td>
					<td valign="top">
						<table class="form">
						<tr>
							<td class="name w130"><?php echo $this->_tpl_vars['lang']['listing_id']; ?>
</td>
							<td class="field">
								<input class="filters" type="text" id="listing_id" maxlength="60" />
							</td>
						</tr>
						<tr>
							<td class="name w130"><?php echo $this->_tpl_vars['lang']['username']; ?>
</td>
							<td class="field">
								<input class="filters" type="text" maxlength="255" id="Account" />
							</td>
						</tr>
						<tr>
						<td class="name w130"><?php echo $this->_tpl_vars['lang']['name']; ?>
</td>
							<td class="field">
								<input class="filters" type="text" id="name" maxlength="60" />
							</td>
						</tr>
						<tr>
							<td class="name w130"><?php echo $this->_tpl_vars['lang']['mail']; ?>
</td>
							<td class="field">
								<input class="filters" type="text" id="email" maxlength="60" />
							</td>
						</tr>
						<tr>
							<td class="name w130"><?php echo $this->_tpl_vars['lang']['account_type']; ?>
</td>
							<td class="field">
								<select class="filters w200" id="account_type">
									<option value=""><?php echo $this->_tpl_vars['lang']['select']; ?>
</option>
									<?php $_from = $this->_tpl_vars['account_types']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['type']):
?>
										<option value="<?php echo $this->_tpl_vars['type']['Key']; ?>
" <?php if ($this->_tpl_vars['sPost']['profile']['type'] == $this->_tpl_vars['type']['Key']): ?>selected="selected"<?php endif; ?>><?php echo $this->_tpl_vars['type']['name']; ?>
</option>
									<?php endforeach; endif; unset($_from); ?>
								</select>
							</td>
						</tr>
						
						<?php echo rlHook::load(array('name' => 'apTplListingsSearch2'), $this);?>

						
						</table>
					</td>
				</tr>
				</table>
				
				<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_end.tpl') : smarty_modifier_cat($_tmp, 'm_block_end.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
			</div>
			
			<script type="text/javascript">
			<?php echo '
			var filters = new Array();
			var step = 0;
	
			$(document).ready(function(){
				
				if ( readCookie(\'listings_sc\') )
				{
					$(\'#filters\').show();
					var cookie_filters = readCookie(\'listings_sc\').split(\',\');
					
					for (var i in cookie_filters)
					{
						if ( typeof(cookie_filters[i]) == \'string\' )
						{
							var item = cookie_filters[i].split(\'||\');
							$(\'#\'+item[0]).selectOptions(item[1]);
						}
					}
				}
				
				$(\'select#Type\').change(function(){
					var key = $(this).val();
					
					if ( key )
					{
						$(\'select#Category_ID option\').hide();
						$(\'select#Category_ID option[id^=option_\'+key+\']\').show();
					}
					else
					{
						$(\'select#Category_ID option\').show();
					}
				});
				
				$(\'#filter_button\').click(function(){
					filters = new Array();
					write_filters = new Array();
					
					createCookie(\'listings_pn\', 0, 1);
					
					$(\'.filters\').each(function(){
						if ($(this).attr(\'value\') != 0)
						{
							filters.push(new Array($(this).attr(\'id\'), $(this).attr(\'value\')));
							write_filters.push($(this).attr(\'id\')+\'||\'+$(this).attr(\'value\'));
						}
					});
	
					'; ?>
<?php echo rlHook::load(array('name' => 'apTplListingsSearchJS'), $this);?>
<?php echo '
					
					// save search criteria
					createCookie(\'listings_sc\', write_filters, 1);
					
					// reload grid
					listingsGrid.filters = filters;
					listingsGrid.reload();
				});
				
				$(\'#reset_filter_button\').click(function(){
					eraseCookie(\'listings_sc\');
					listingsGrid.reset();
					
					$("#filters select option[value=\'\']").attr(\'selected\', true);
					$("#filters input[type=text]").val(\'\');
					$("#Category_ID option").show();
				});
	
				/* autocomplete js */
				$(\'#Account\').rlAutoComplete();
			});
			'; ?>

			</script>
			<!-- filters end -->
		<?php endif; ?>
		
		<!-- categories list -->
		<?php if ($this->_tpl_vars['aRights'][$this->_tpl_vars['cKey']]['add'] && ! $_GET['action']): ?>
		<div id="new_listing" class="hide">
			<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_start.tpl') : smarty_modifier_cat($_tmp, 'm_block_start.tpl')), 'smarty_include_vars' => array('block_caption' => $this->_tpl_vars['lang']['choose_category'])));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
			
				<div id="categories">
				<?php $_from = $this->_tpl_vars['sections']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['section']):
?>
					<fieldset class="light">
					<legend id="legend_section_<?php echo $this->_tpl_vars['section']['ID']; ?>
" class="up" onclick="fieldset_action('section_<?php echo $this->_tpl_vars['section']['ID']; ?>
');"><?php echo $this->_tpl_vars['section']['name']; ?>
</legend>
					<div id="section_<?php echo $this->_tpl_vars['section']['ID']; ?>
">
						<div class="tree">
							<?php if (! empty ( $this->_tpl_vars['section']['Categories'] )): ?>
								<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'category_level_link.tpl') : smarty_modifier_cat($_tmp, 'category_level_link.tpl')), 'smarty_include_vars' => array('categories' => $this->_tpl_vars['section']['Categories'],'first' => true)));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
							<?php else: ?>
								<div style="padding: 0 0 8px 10px;"><?php echo $this->_tpl_vars['lang']['no_items_in_sections']; ?>
</div>
							<?php endif; ?>
						</div>
					</div>
					</fieldset>
				<?php endforeach; endif; unset($_from); ?>
				</div>
		
			<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_end.tpl') : smarty_modifier_cat($_tmp, 'm_block_end.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
		</div>
		<script type="text/javascript">
		<?php echo '
		
		$(document).ready(function(){
			flynax.treeLoadLevel(\'link\', \'crossedTree\', \'div#new_listing\');
		});
		
		'; ?>

		</script>
		<?php endif; ?>
		<!-- categories list end -->

	</div>
	
	<?php $this->assign('sPost', $_POST); ?>
	
	<?php if ($_GET['action'] == 'add'): ?>
	
		<!-- add new listing -->
		<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_start.tpl') : smarty_modifier_cat($_tmp, 'm_block_start.tpl')), 'smarty_include_vars' => array('block_caption' => $this->_tpl_vars['lang']['add_listing'])));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
		
		<!-- listing fieldset -->
		<div style="margin: 5px 10px 10px;">
			<form onsubmit="return submitHandler();" id="add_listing" method="post" action="<?php echo $this->_tpl_vars['rlBase']; ?>
index.php?controller=<?php echo $_GET['controller']; ?>
&amp;action=add&amp;category=<?php echo $_GET['category']; ?>
" enctype="multipart/form-data">
				<input type="hidden" name="action" value="add" />
			
				<!-- display plans -->
				<?php if (! empty ( $this->_tpl_vars['plans'] )): ?>
				<fieldset class="light">
					<legend id="legend_plans" class="up" onclick="fieldset_action('plans');"><?php echo $this->_tpl_vars['lang']['plans']; ?>
</legend>
					<div id="plans">
						<?php $_from = $this->_tpl_vars['plans']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['fPlan'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['fPlan']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['plan']):
        $this->_foreach['fPlan']['iteration']++;
?>
							<div class="plan_item">
								<table class="sTable">
								<tr>
									<td align="center" style="width: 30px"><input accesskey="<?php echo $this->_tpl_vars['plan']['Cross']; ?>
" style="margin: 0 10px 0 0;" id="plan_<?php echo $this->_tpl_vars['plan']['ID']; ?>
" type="radio" name="f[l_plan]" value="<?php echo $this->_tpl_vars['plan']['ID']; ?>
" <?php if ($this->_tpl_vars['plan']['ID'] == $_POST['f']['l_plan']): ?>checked="checked"<?php else: ?><?php if (($this->_foreach['fPlan']['iteration'] <= 1)): ?>checked="checked"<?php endif; ?><?php endif; ?> /></td>
									<td>
										<label for="plan_<?php echo $this->_tpl_vars['plan']['ID']; ?>
" class="blue_11_normal">
											<?php $this->assign('l_type', ((is_array($_tmp=$this->_tpl_vars['plan']['Type'])) ? $this->_run_mod_handler('cat', true, $_tmp, '_plan') : smarty_modifier_cat($_tmp, '_plan'))); ?>
											<?php echo $this->_tpl_vars['plan']['name']; ?>
 - <b><?php if ($this->_tpl_vars['plan']['Price'] > 0): ?><?php echo $this->_tpl_vars['config']['system_currency']; ?>
<?php echo $this->_tpl_vars['plan']['Price']; ?>
<?php else: ?><?php echo $this->_tpl_vars['lang']['free']; ?>
<?php endif; ?></b>
										</label>
										<div><?php echo $this->_tpl_vars['plan']['des']; ?>
</div>
									</td>
								</tr>
								</table>
							</div>
						<?php endforeach; endif; unset($_from); ?>
					</div>
				</fieldset>
				<?php endif; ?>
				<!-- display plans end -->
				
				<!-- crossed categories -->
				<div id="crossed_area" class="hide">
					<input type="hidden" name="crossed_done" value="<?php if ($_SESSION['add_listing']['crossed_done']): ?>1<?php endif; ?>" />
				
					<fieldset class="light">
						<legend id="legend_crossed" class="up" onclick="fieldset_action('crossed');"><?php echo $this->_tpl_vars['lang']['crossed_categories']; ?>
</legend>
						<div id="crossed">
							<div class="auth">
								<div style="padding: 0 0 10px 0;">
									<div class="dark" id="cc_text"><?php echo ((is_array($_tmp=$this->_tpl_vars['lang']['crossed_top_text'])) ? $this->_run_mod_handler('replace', true, $_tmp, '[number]', '<b id="cc_number"></b>') : smarty_modifier_replace($_tmp, '[number]', '<b id="cc_number"></b>')); ?>
</div>
									<div class="dark hide" id="cc_text_denied"><?php echo $this->_tpl_vars['lang']['crossed_top_text_denied']; ?>
</div>
								</div>
								
								<!-- print sections/categories tree -->
								<div id="crossed_tree" class="tree<?php if ($_POST['crossed_done']): ?> hide<?php endif; ?>">
								<?php $_from = $this->_tpl_vars['sections']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['section']):
?>
									<fieldset class="light">
										<legend id="legend_crossed_<?php echo $this->_tpl_vars['section']['ID']; ?>
" class="up" onclick="fieldset_action('crossed_<?php echo $this->_tpl_vars['section']['ID']; ?>
');"><?php echo $this->_tpl_vars['section']['name']; ?>
</legend>
										<div id="crossed_<?php echo $this->_tpl_vars['section']['ID']; ?>
" class="tree">
											<?php $this->assign('type_page_key', ((is_array($_tmp='lt_')) ? $this->_run_mod_handler('cat', true, $_tmp, $this->_tpl_vars['section']['Key']) : smarty_modifier_cat($_tmp, $this->_tpl_vars['section']['Key']))); ?>
											<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'fieldset_header.tpl') : smarty_modifier_cat($_tmp, 'fieldset_header.tpl')), 'smarty_include_vars' => array('id' => $this->_tpl_vars['section']['ID'],'name' => $this->_tpl_vars['section']['name'])));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
											
											<?php if (! empty ( $this->_tpl_vars['section']['Categories'] )): ?>
												<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'category_level_crossed.tpl') : smarty_modifier_cat($_tmp, 'category_level_crossed.tpl')), 'smarty_include_vars' => array('categories' => $this->_tpl_vars['section']['Categories'],'first' => true)));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
											<?php else: ?>
												<div class="dark"><?php echo $this->_tpl_vars['lang']['no_items_in_sections']; ?>
</div>
											<?php endif; ?>
										
											<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'fieldset_footer.tpl') : smarty_modifier_cat($_tmp, 'fieldset_footer.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
										</div>
									</fieldset>
								<?php endforeach; endif; unset($_from); ?>
								</div>
								<!-- print sections/categories tree end -->
								
								<ul class="hide" id="crossed_selected"><li class="first dark"><b><?php echo $this->_tpl_vars['lang']['selected_crossed_categories']; ?>
</b></li></ul>
								<input id="crossed_button" type="button" value="<?php if ($_POST['crossed_done']): ?><?php echo $this->_tpl_vars['lang']['manage']; ?>
<?php else: ?><?php echo $this->_tpl_vars['lang']['done']; ?>
<?php endif; ?>" />
							</div>
						</div>
					</fieldset>
				</div>
				
				<script type="text/javascript">
				var plans = Array();
				var selected_plan_id = <?php if ($_POST['f']['l_plan']): ?><?php echo $_POST['f']['l_plan']; ?>
<?php else: ?>0<?php endif; ?>;
				var ca_post = <?php if ($this->_tpl_vars['crossed']): ?>[<?php $_from = $this->_tpl_vars['crossed']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['crossedF'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['crossedF']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['crossed_cat']):
        $this->_foreach['crossedF']['iteration']++;
?>['<?php echo $this->_tpl_vars['crossed_cat']; ?>
']<?php if (! ($this->_foreach['crossedF']['iteration'] == $this->_foreach['crossedF']['total'])): ?>,<?php endif; ?><?php endforeach; endif; unset($_from); ?>]<?php else: ?>false<?php endif; ?>;
				var cc_parentPoints = <?php if ($this->_tpl_vars['parentPoints']): ?>[<?php $_from = $this->_tpl_vars['parentPoints']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['parentF'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['parentF']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['parent_point']):
        $this->_foreach['parentF']['iteration']++;
?>['<?php echo $this->_tpl_vars['parent_point']; ?>
']<?php if (! ($this->_foreach['parentF']['iteration'] == $this->_foreach['parentF']['total'])): ?>,<?php endif; ?><?php endforeach; endif; unset($_from); ?>]<?php else: ?>false<?php endif; ?>;
	
				<?php $_from = $this->_tpl_vars['plans']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['plan']):
?>
				plans[<?php echo $this->_tpl_vars['plan']['ID']; ?>
] = new Array();
				plans[<?php echo $this->_tpl_vars['plan']['ID']; ?>
]['Key'] = '<?php echo $this->_tpl_vars['plan']['Key']; ?>
';
				plans[<?php echo $this->_tpl_vars['plan']['ID']; ?>
]['Cross'] = <?php echo $this->_tpl_vars['plan']['Cross']; ?>
;
				<?php endforeach; endif; unset($_from); ?>
				
				<?php echo '
				
				$(document).ready(function(){
					flynax.treeLoadLevel(\'crossed\', \'crossedTree\');
					
					if ( plans[selected_plan_id] && plans[selected_plan_id][\'Cross\'] )
					{
						crossCount = plans[selected_plan_id][\'Cross\'];
						$(\'#crossed_area\').show();
						crossedTree();
					}
					
					/* plans click handler */
					$(\'input[name="f[l_plan]"]\').click(function(){
						selected_plan_id = $(this).attr(\'id\').split(\'_\')[1];
						crossCount = plans[selected_plan_id][\'Cross\'];
	
						if ( crossCount > 0 )
						{
							$(\'#crossed_area\').slideDown();
							crossedTree();
						}
						else
						{
							$(\'#crossed_area\').slideUp();
						}
					});
				});
				
				'; ?>

				</script>
				<script type="text/javascript" src="<?php echo @RL_LIBS_URL; ?>
javascript/crossed.js"></script>
				<!-- crossed categories end -->
		
				<table class="form" style="margin: 0 16px 15px;">
				<tr>
					<td class="name"><?php echo $this->_tpl_vars['lang']['set_owner']; ?>
 <span class="red">*</span></td>
					<td class="field">
						<input type="text" name="account_id" id="account_id" value="<?php $_from = $this->_tpl_vars['accounts']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['account']):
?><?php if ($this->_tpl_vars['sPost']['account_id'] == $this->_tpl_vars['account']['ID']): ?><?php echo $this->_tpl_vars['account']['Username']; ?>
<?php endif; ?><?php endforeach; endif; unset($_from); ?>" />
						
						<script type="text/javascript">
						var post_account_id = <?php if ($this->_tpl_vars['sPost']['account_id']): ?><?php echo $this->_tpl_vars['sPost']['account_id']; ?>
<?php else: ?>false<?php endif; ?>;
						<?php echo '
							$(\'#account_id\').rlAutoComplete({add_id: true, id: post_account_id});
						'; ?>

						</script>
					</td>
				</tr>
				<tr>
					<td class="name"><?php echo $this->_tpl_vars['lang']['status']; ?>
 <span class="red">*</span></td>
					<td class="field">
						<select name="status" class="login_input_select">
							<option value="active" <?php if ($this->_tpl_vars['sPost']['status'] == 'active'): ?>selected="selected"<?php endif; ?>><?php echo $this->_tpl_vars['lang']['active']; ?>
</option>
							<option value="approval" <?php if ($this->_tpl_vars['sPost']['status'] == 'approval'): ?>selected="selected"<?php endif; ?>><?php echo $this->_tpl_vars['lang']['approval']; ?>
</option>
						</select>
					</td>
				</tr>
				
				<?php echo rlHook::load(array('name' => 'apTplListingsFormAdd'), $this);?>

				
				</table>
				
				<?php $_from = $this->_tpl_vars['form']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['group']):
?>
				<?php if ($this->_tpl_vars['group']['Group_ID']): ?>
					<?php if ($this->_tpl_vars['group']['Fields'] || ! $this->_tpl_vars['group']['Display']): ?>
						<?php $this->assign('hide', 'false'); ?>
					<?php else: ?>
						<?php $this->assign('hide', 'true'); ?>
					<?php endif; ?>
		
					<fieldset>
						<legend id="legend_group_<?php echo $this->_tpl_vars['group']['ID']; ?>
" class="up" onclick="fieldset_action('group_<?php echo $this->_tpl_vars['group']['ID']; ?>
');"><?php echo $this->_tpl_vars['lang'][$this->_tpl_vars['group']['pName']]; ?>
</legend>
						<div id="group_<?php echo $this->_tpl_vars['group']['ID']; ?>
">
						<?php if ($this->_tpl_vars['group']['Fields']): ?>
							<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'field.tpl') : smarty_modifier_cat($_tmp, 'field.tpl')), 'smarty_include_vars' => array('fields' => $this->_tpl_vars['group']['Fields'])));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
						<?php else: ?>
							<span class="blue_middle"><?php echo $this->_tpl_vars['lang']['no_items_in_group']; ?>
</span>
						<?php endif; ?>
						</div>
					</fieldset>
				<?php else: ?>
					<div style="padding: 0 0 0 16px;">
						<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'field.tpl') : smarty_modifier_cat($_tmp, 'field.tpl')), 'smarty_include_vars' => array('fields' => $this->_tpl_vars['group']['Fields'])));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
					</div>
				<?php endif; ?>
				<?php endforeach; endif; unset($_from); ?>
		
				<table class="form" style="margin: 0 16px;">
				<tr>
					<td class="no_divider"></td>
					<td class="field"><input type="submit" name="finish" value="<?php echo $this->_tpl_vars['lang']['add_listing']; ?>
" /></td>
				</tr>
				</table>
			</form>
		</div>
		
		<!-- listing fieldset end -->
		<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_end.tpl') : smarty_modifier_cat($_tmp, 'm_block_end.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
		<!-- add new listing end -->
	
	<?php elseif ($_GET['action'] == 'edit'): ?>
	
		<!-- listing fieldset -->
		<?php if (! empty ( $this->_tpl_vars['form'] )): ?>
		<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_start.tpl') : smarty_modifier_cat($_tmp, 'm_block_start.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
		
		<form onsubmit="return submitHandler();" id="edit_listing" method="post" action="<?php echo $this->_tpl_vars['rlBase']; ?>
index.php?controller=<?php echo $_GET['controller']; ?>
&amp;action=edit&amp;id=<?php echo $_GET['id']; ?>
<?php if ($_GET['ui']): ?>&amp;ui=<?php echo $_GET['ui']; ?>
<?php endif; ?><?php if ($_GET['cat_id']): ?>&amp;cat_id=<?php echo $_GET['cat_id']; ?>
<?php endif; ?>" enctype="multipart/form-data">
			<input type="hidden" name="action" value="edit" />
			<input type="hidden" name="fromPost" value="1" />
			
			<!-- display plans -->
			<?php if (! empty ( $this->_tpl_vars['plans'] )): ?>
			<fieldset class="light">
			
				<legend id="legend_plans" class="up" onclick="fieldset_action('plans');"><?php echo $this->_tpl_vars['lang']['plans']; ?>
</legend>
				<div id="plans">
					<?php $_from = $this->_tpl_vars['plans']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['fPlan'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['fPlan']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['plan']):
        $this->_foreach['fPlan']['iteration']++;
?>
						<div class="plan_item<?php if ($this->_tpl_vars['plan']['ID'] != $_POST['f']['l_plan']): ?> hide<?php endif; ?>">
							<table class="sTable">
							<tr>
								<td align="center" style="width: 30px"><input accesskey="<?php echo $this->_tpl_vars['plan']['Cross']; ?>
" style="margin: 0 10px 0 0;" id="plan_<?php echo $this->_tpl_vars['plan']['ID']; ?>
" type="radio" name="f[l_plan]" value="<?php echo $this->_tpl_vars['plan']['ID']; ?>
" <?php if ($this->_tpl_vars['plan']['ID'] == $_POST['f']['l_plan']): ?>checked="checked"<?php else: ?><?php if (($this->_foreach['fPlan']['iteration'] <= 1)): ?>checked="checked"<?php endif; ?><?php endif; ?> /></td>
								<td>
									<label for="plan_<?php echo $this->_tpl_vars['plan']['ID']; ?>
" class="blue_11_normal">
										<?php $this->assign('l_type', ((is_array($_tmp=$this->_tpl_vars['plan']['Type'])) ? $this->_run_mod_handler('cat', true, $_tmp, '_plan') : smarty_modifier_cat($_tmp, '_plan'))); ?>
										<?php echo $this->_tpl_vars['plan']['name']; ?>
 - <b><?php if ($this->_tpl_vars['plan']['Price'] > 0): ?><?php echo $this->_tpl_vars['config']['system_currency']; ?>
<?php echo $this->_tpl_vars['plan']['Price']; ?>
<?php else: ?><?php echo $this->_tpl_vars['lang']['free']; ?>
<?php endif; ?></b>
									</label>
									<div><?php echo $this->_tpl_vars['plan']['des']; ?>
</div>
								</td>
							</tr>
							</table>
						</div>
					<?php endforeach; endif; unset($_from); ?>
					
					<?php if (count($this->_tpl_vars['plans']) > 1 || ! $_POST['f']['l_plan']): ?>
						<input id="manage_plans" type="button" value="<?php echo $this->_tpl_vars['lang']['manage']; ?>
" />
					<?php endif; ?>
				</div>
			</fieldset>
			
			<script type="text/javascript">
			<?php echo '
			var plans_expand = false;
			$(document).ready(function(){
				$(\'#manage_plans\').click(function(){
					if ( plans_expand )
					{
						plans_expand = false;
						$(\'div#plans div.hide\').fadeOut();
						$(this).val(\''; ?>
<?php echo $this->_tpl_vars['lang']['manage']; ?>
<?php echo '\');
					}
					else
					{
						plans_expand = true;
						$(this).val(\''; ?>
<?php echo $this->_tpl_vars['lang']['apply']; ?>
<?php echo '\');
						$(\'div#plans div.hide\').fadeIn();
					}
				});
				
				$(\'div#plans div.plan_item\').click(function(){
					$(\'div#plans div.plan_item\').addClass(\'hide\').css(\'display\', \'block\');
					$(this).removeClass(\'hide\');
				});
			});
			
			'; ?>

			</script>
			<?php endif; ?>
			<!-- display plans end -->
		
			<!-- crossed categories -->
			<div id="crossed_area" <?php if (! $this->_tpl_vars['plan_info']['Cross']): ?>class="hide"<?php endif; ?>>
				<input type="hidden" name="crossed_done" value="<?php if ($_SESSION['add_listing']['crossed_done']): ?>1<?php endif; ?>" />
				
				<fieldset class="light">
					<legend id="legend_crossed" class="up" onclick="fieldset_action('crossed');"><?php echo $this->_tpl_vars['lang']['crossed_categories']; ?>
</legend>
					<div id="crossed">
		
						<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'fieldset_header.tpl') : smarty_modifier_cat($_tmp, 'fieldset_header.tpl')), 'smarty_include_vars' => array('id' => 'crossed','name' => $this->_tpl_vars['lang']['crossed_categories'])));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
						<div class="auth">
							<div style="padding: 0 0 10px 0;">
								<div class="dark" id="cc_text"><?php echo ((is_array($_tmp=$this->_tpl_vars['lang']['crossed_top_text'])) ? $this->_run_mod_handler('replace', true, $_tmp, '[number]', '<b id="cc_number"></b>') : smarty_modifier_replace($_tmp, '[number]', '<b id="cc_number"></b>')); ?>
</div>
								<div class="dark hide" id="cc_text_denied"><?php echo $this->_tpl_vars['lang']['crossed_top_text_denied']; ?>
</div>
							</div>
							
							<!-- print sections/categories tree -->
							<div id="crossed_tree" class="tree<?php if ($_POST['crossed_done']): ?> hide<?php endif; ?>">
							<?php $_from = $this->_tpl_vars['sections']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['section']):
?>
								<fieldset class="light">
									<legend id="legend_crossed_<?php echo $this->_tpl_vars['section']['ID']; ?>
" class="up" onclick="fieldset_action('crossed_<?php echo $this->_tpl_vars['section']['ID']; ?>
');"><?php echo $this->_tpl_vars['section']['name']; ?>
</legend>
									<div id="crossed_<?php echo $this->_tpl_vars['section']['ID']; ?>
" class="tree">
										<?php $this->assign('type_page_key', ((is_array($_tmp='lt_')) ? $this->_run_mod_handler('cat', true, $_tmp, $this->_tpl_vars['section']['Key']) : smarty_modifier_cat($_tmp, $this->_tpl_vars['section']['Key']))); ?>
										<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'fieldset_header.tpl') : smarty_modifier_cat($_tmp, 'fieldset_header.tpl')), 'smarty_include_vars' => array('id' => $this->_tpl_vars['section']['ID'],'name' => $this->_tpl_vars['section']['name'])));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
										
										<?php if (! empty ( $this->_tpl_vars['section']['Categories'] )): ?>
											<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'category_level_crossed.tpl') : smarty_modifier_cat($_tmp, 'category_level_crossed.tpl')), 'smarty_include_vars' => array('categories' => $this->_tpl_vars['section']['Categories'],'first' => true)));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
										<?php else: ?>
											<div class="dark"><?php echo $this->_tpl_vars['lang']['no_items_in_sections']; ?>
</div>
										<?php endif; ?>
									
										<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'fieldset_footer.tpl') : smarty_modifier_cat($_tmp, 'fieldset_footer.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
									</div>
								</fieldset>
							<?php endforeach; endif; unset($_from); ?>
							</div>
							<!-- print sections/categories tree end -->
							
							<ul class="hide" id="crossed_selected"><li class="first dark"><b><?php echo $this->_tpl_vars['lang']['selected_crossed_categories']; ?>
</b></li></ul>
							<input id="crossed_button" type="button" value="<?php if ($_POST['crossed_done']): ?><?php echo $this->_tpl_vars['lang']['manage']; ?>
<?php else: ?><?php echo $this->_tpl_vars['lang']['done']; ?>
<?php endif; ?>" />
						</div>
						<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'fieldset_footer.tpl') : smarty_modifier_cat($_tmp, 'fieldset_footer.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
						
						<script type="text/javascript">
						var plans = Array();
						var selected_plan_id = <?php if ($_POST['f']['l_plan']): ?><?php echo $_POST['f']['l_plan']; ?>
<?php else: ?>0<?php endif; ?>;
						var ca_post = <?php if ($this->_tpl_vars['crossed']): ?>[<?php $_from = $this->_tpl_vars['crossed']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['crossedF'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['crossedF']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['crossed_cat']):
        $this->_foreach['crossedF']['iteration']++;
?>['<?php echo $this->_tpl_vars['crossed_cat']; ?>
']<?php if (! ($this->_foreach['crossedF']['iteration'] == $this->_foreach['crossedF']['total'])): ?>,<?php endif; ?><?php endforeach; endif; unset($_from); ?>]<?php else: ?>false<?php endif; ?>;
						var cc_parentPoints = <?php if ($this->_tpl_vars['parentPoints']): ?>[<?php $_from = $this->_tpl_vars['parentPoints']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['parentF'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['parentF']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['parent_point']):
        $this->_foreach['parentF']['iteration']++;
?>['<?php echo $this->_tpl_vars['parent_point']; ?>
']<?php if (! ($this->_foreach['parentF']['iteration'] == $this->_foreach['parentF']['total'])): ?>,<?php endif; ?><?php endforeach; endif; unset($_from); ?>]<?php else: ?>false<?php endif; ?>;
			
						<?php $_from = $this->_tpl_vars['plans']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['plan']):
?>
						plans[<?php echo $this->_tpl_vars['plan']['ID']; ?>
] = new Array();
						plans[<?php echo $this->_tpl_vars['plan']['ID']; ?>
]['Key'] = '<?php echo $this->_tpl_vars['plan']['Key']; ?>
';
						plans[<?php echo $this->_tpl_vars['plan']['ID']; ?>
]['Cross'] = <?php echo $this->_tpl_vars['plan']['Cross']; ?>
;
						<?php endforeach; endif; unset($_from); ?>
						
						<?php echo '
						
						$(document).ready(function(){
							flynax.treeLoadLevel(\'crossed\', \'crossedTree\');
							
							if ( plans[selected_plan_id] && plans[selected_plan_id][\'Cross\'] )
							{
								crossCount = plans[selected_plan_id][\'Cross\'];
								$(\'#crossed_area\').show();
								crossedTree();
							}
							
							/* plans click handler */
							$(\'input[name="f[l_plan]"]\').click(function(){
								selected_plan_id = $(this).attr(\'id\').split(\'_\')[1];
								crossCount = plans[selected_plan_id][\'Cross\'];
			
								if ( crossCount > 0 )
								{
									$(\'#crossed_area\').slideDown();
									crossedTree();
								}
								else
								{
									$(\'#crossed_area\').slideUp();
								}
							});
						});
						
						'; ?>

						</script>
						<script type="text/javascript" src="<?php echo @RL_LIBS_URL; ?>
javascript/crossed.js"></script>
					</div>
				</fieldset>
			</div>
			<!-- crossed categories end -->
		
			<script type="text/javascript" src="<?php echo @RL_LIBS_URL; ?>
ckeditor/ckeditor.js"></script>
			
			<table class="form" style="margin: 0 16px 15px;">
			<tr>
				<td class="name">
					<?php echo $this->_tpl_vars['lang']['set_owner']; ?>

				</td>
				<td class="field">
					<input type="text" name="account_id" id="account_id" value="<?php $_from = $this->_tpl_vars['accounts']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['account']):
?><?php if ($this->_tpl_vars['sPost']['account_id'] == $this->_tpl_vars['account']['ID']): ?><?php echo $this->_tpl_vars['account']['Username']; ?>
<?php endif; ?><?php endforeach; endif; unset($_from); ?>" />
					
					<script type="text/javascript">
					var account_id = <?php if ($this->_tpl_vars['sPost']['account_id']): ?><?php echo $this->_tpl_vars['sPost']['account_id']; ?>
<?php else: ?>false<?php endif; ?>;
					<?php echo '
						$(\'#account_id\').rlAutoComplete({add_id: true, id: account_id});
					'; ?>

					</script>
				</td>
			</tr>
			<tr>
				<td class="name"><?php echo $this->_tpl_vars['lang']['status']; ?>
 <span class="red">*</span></td>
				<td class="field">
					<select name="status" class="login_input_select">
						<option value="active" <?php if ($this->_tpl_vars['sPost']['status'] == 'active'): ?>selected="selected"<?php endif; ?>><?php echo $this->_tpl_vars['lang']['active']; ?>
</option>
						<option value="approval" <?php if ($this->_tpl_vars['sPost']['status'] == 'approval'): ?>selected="selected"<?php endif; ?>><?php echo $this->_tpl_vars['lang']['approval']; ?>
</option>
					</select>
				</td>
			</tr>
			
			<?php echo rlHook::load(array('name' => 'apTplListingsFormEdit'), $this);?>

			
			</table>
			
			<?php $_from = $this->_tpl_vars['form']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['group']):
?>
			<?php if ($this->_tpl_vars['group']['Group_ID']): ?>
				<?php if ($this->_tpl_vars['group']['Fields'] || ! $this->_tpl_vars['group']['Display']): ?>
					<?php $this->assign('hide', 'false'); ?>
				<?php else: ?>
					<?php $this->assign('hide', 'true'); ?>
				<?php endif; ?>
				
				<fieldset>
				<legend id="legend_group_<?php echo $this->_tpl_vars['group']['ID']; ?>
" class="up" onclick="fieldset_action('group_<?php echo $this->_tpl_vars['group']['ID']; ?>
');"><?php echo $this->_tpl_vars['lang'][$this->_tpl_vars['group']['pName']]; ?>
</legend>
					<div id="group_<?php echo $this->_tpl_vars['group']['ID']; ?>
">
					<?php if ($this->_tpl_vars['group']['Fields']): ?>
						<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'field.tpl') : smarty_modifier_cat($_tmp, 'field.tpl')), 'smarty_include_vars' => array('fields' => $this->_tpl_vars['group']['Fields'])));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
					<?php else: ?>
						<span><?php echo $this->_tpl_vars['lang']['no_items_in_group']; ?>
</span>
					<?php endif; ?>
					</div>
				</fieldset>
			<?php else: ?>
				<div style="padding: 0 16px;">
					<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'field.tpl') : smarty_modifier_cat($_tmp, 'field.tpl')), 'smarty_include_vars' => array('fields' => $this->_tpl_vars['group']['Fields'])));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
				</div>
			<?php endif; ?>
			<?php endforeach; endif; unset($_from); ?>
			
			<table class="form" style="margin: 0 16px;">
			<tr>
				<td class="no_divider"></td>
				<td class="field"><input type="submit" name="finish" value="<?php echo $this->_tpl_vars['lang']['edit_listing']; ?>
" /></td>
			</tr>
			</table>
		</form>
		
		<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_end.tpl') : smarty_modifier_cat($_tmp, 'm_block_end.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
		<?php endif; ?>
		
		<!-- listing fieldset end -->
	<?php elseif ($_GET['action'] == 'photos'): ?>
		<!-- manage listing photo -->
		
		<script type="text/javascript" src="<?php echo @RL_LIBS_URL; ?>
jquery/jquery.jcrop.js"></script>
		<script src="<?php echo $this->_tpl_vars['rlTplBase']; ?>
js/crop.js" type="text/javascript"></script>
		
		<style type="text/css">
		@import url("<?php echo @RL_LIBS_URL; ?>
jquery/jcrop/jquery.Jcrop.css");
		</style>
	
		<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_start.tpl') : smarty_modifier_cat($_tmp, 'm_block_start.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
		
		<!-- listing info -->
		<fieldset style="margin: 0 0 10px 0;">
			<legend id="legend_details" class="up" onclick="fieldset_action('details');"><?php echo $this->_tpl_vars['lang']['listing_details']; ?>
</legend>
			<div id="details">
				<table class="list" style="margin: 0 10px 5px 10px;">
				<?php $_from = $this->_tpl_vars['listing']['fields']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['fListings'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['fListings']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['field'] => $this->_tpl_vars['item']):
        $this->_foreach['fListings']['iteration']++;
?>
				<?php if (! empty ( $this->_tpl_vars['item']['value'] )): ?>
				<tr>
					<td class="name"><?php echo $this->_tpl_vars['item']['name']; ?>
:</td>
					<td class="value"><?php echo $this->_tpl_vars['item']['value']; ?>
</td>
				</tr>
				<?php endif; ?>
				<?php endforeach; endif; unset($_from); ?>
				</table>
			</div>
		</fieldset>
		<!-- listing info end -->
		
		<!-- photos list -->
		<fieldset style="margin: 10px 0;">
			<legend id="legend_photos_list" class="up" onclick="fieldset_action('photos_list');"><?php echo $this->_tpl_vars['lang']['pictures_manager']; ?>
</legend>
			<div id="photos_list">
				<div style="padding: 0 10px;" id="photos_dom">
					<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'photo_manager.tpl') : smarty_modifier_cat($_tmp, 'photo_manager.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
				</div>
			</div>
		</fieldset>
		<!-- photos list end -->
		
		<?php echo rlHook::load(array('name' => 'apTplListingsPhotos'), $this);?>

		
		<!-- file crop -->
		<div id="width_detect"></div>
		<div id="crop_block" class="hide">
			<fieldset style="margin: 10px 0;">
				<legend id="legend_crop_area" class="up" onclick="fieldset_action('crop_area');"><?php echo $this->_tpl_vars['lang']['pictures_manager']; ?>
</legend>
				<div id="crop_area">
		
					<div class="dark"><?php echo $this->_tpl_vars['lang']['crop_notice']; ?>
</div>
					<div id="crop_obj" style="padding: 10px 0;"></div>
				
					<input type="button" class="button" value="<?php echo $this->_tpl_vars['lang']['rl_accept']; ?>
" id="crop_accept" /> 
					<input type="button" class="button" value="<?php echo $this->_tpl_vars['lang']['cancel']; ?>
" id="crop_cancel" />
		
				</div>
			</fieldset>
		</div>
		<!-- file crop end -->
		
		<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_end.tpl') : smarty_modifier_cat($_tmp, 'm_block_end.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
		
		<!-- manage listing photo end -->
	<?php elseif ($_GET['action'] == 'video'): ?>
		<!-- add listing video -->
		
		<?php if ($this->_tpl_vars['listing']['Plan_video'] || $this->_tpl_vars['listing']['Video_unlim']): ?>
		
			<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_start.tpl') : smarty_modifier_cat($_tmp, 'm_block_start.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
		
			<!-- listing info -->
			<fieldset style="margin: 0 0 10px 0;">
				<legend id="legend_details" class="up" onclick="fieldset_action('details');"><?php echo $this->_tpl_vars['lang']['listing_details']; ?>
</legend>
				<div id="details">
					<table class="list" style="margin: 0 10px 5px 10px;">
					<?php $_from = $this->_tpl_vars['listing']['fields']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['fListings'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['fListings']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['field'] => $this->_tpl_vars['item']):
        $this->_foreach['fListings']['iteration']++;
?>
					<?php if (! empty ( $this->_tpl_vars['item']['value'] )): ?>
					<tr>
						<td class="name"><?php echo $this->_tpl_vars['item']['name']; ?>
:</td>
						<td class="value"><?php echo $this->_tpl_vars['item']['value']; ?>
</td>
					</tr>
					<?php endif; ?>
					<?php endforeach; endif; unset($_from); ?>
					</table>
				</div>
			</fieldset>
			<!-- listing info end -->
			
			<!-- file uploader -->
			<fieldset style="margin: 10px 0;">
				<?php if ($this->_tpl_vars['video_allow'] && ! $this->_tpl_vars['listing']['Video_unlim']): ?>
					<?php $this->assign('replace', ('{')."number".('}')); ?>
					<?php $this->assign('video_left', ((is_array($_tmp=$this->_tpl_vars['lang']['upload_video_left'])) ? $this->_run_mod_handler('replace', true, $_tmp, $this->_tpl_vars['replace'], $this->_tpl_vars['video_allow']) : smarty_modifier_replace($_tmp, $this->_tpl_vars['replace'], $this->_tpl_vars['video_allow']))); ?>
				<?php else: ?>
					<?php $this->assign('video_left', $this->_tpl_vars['lang']['upload_video']); ?>
				<?php endif; ?>
			
				<legend id="legend_upload_area" class="up" onclick="fieldset_action('upload_area');"><span id="video_left"><?php echo $this->_tpl_vars['video_left']; ?>
</span></legend>
				<div id="upload_area">
					
					<?php if (! $this->_tpl_vars['video_allow'] && ! $this->_tpl_vars['listing']['Video_unlim']): ?>
						<?php $this->assign('replace_count', ('{')."count".('}')); ?>
						<?php $this->assign('replace_plan', ('{')."plan".('}')); ?>
						<?php $this->assign('plan_key', ((is_array($_tmp='listing_plans+name+')) ? $this->_run_mod_handler('cat', true, $_tmp, $this->_tpl_vars['listing']['Plan_key']) : smarty_modifier_cat($_tmp, $this->_tpl_vars['listing']['Plan_key']))); ?>
						<div class="grey_middle" style="padding: 0 0 5px 10px"><?php echo ((is_array($_tmp=((is_array($_tmp=$this->_tpl_vars['lang']['no_more_videos'])) ? $this->_run_mod_handler('replace', true, $_tmp, $this->_tpl_vars['replace_count'], $this->_tpl_vars['listing']['Plan_video']) : smarty_modifier_replace($_tmp, $this->_tpl_vars['replace_count'], $this->_tpl_vars['listing']['Plan_video'])))) ? $this->_run_mod_handler('replace', true, $_tmp, $this->_tpl_vars['replace_plan'], $this->_tpl_vars['lang'][$this->_tpl_vars['plan_key']]) : smarty_modifier_replace($_tmp, $this->_tpl_vars['replace_plan'], $this->_tpl_vars['lang'][$this->_tpl_vars['plan_key']])); ?>
</div>
					<?php endif; ?>
					
					<div id="protect" <?php if (! $this->_tpl_vars['video_allow'] && ! $this->_tpl_vars['listing']['Video_unlim']): ?>class="hide"<?php endif; ?>>
					<form method="post" action="<?php echo $this->_tpl_vars['rlBase']; ?>
index.php?controller=<?php echo $_GET['controller']; ?>
&amp;action=video&amp;id=<?php echo $_GET['id']; ?>
" enctype="multipart/form-data">
						<input name="upload" value="true" type="hidden" />
						<div style="margin: 0 0 5px 10px;">
							<table class="form" id="upload_fields">
							<tr>
								<td class="name w130"><?php echo $this->_tpl_vars['lang']['video_type']; ?>
:</td>
								<td class="field">
									<select id="type_selector" name="type" >
										<option value=""><?php echo $this->_tpl_vars['lang']['select']; ?>
</option>
										<option <?php if ($_POST['type'] == 'local'): ?>selected="selected"<?php endif; ?> value="local"><?php echo $this->_tpl_vars['lang']['local']; ?>
</option>
										<option <?php if ($_POST['type'] == 'youtube'): ?>selected="selected"<?php endif; ?> value="youtube"><?php echo $this->_tpl_vars['lang']['youtube']; ?>
</option>
									</select>
								</td>
							</tr>
							</table>
							
							<div id="local_video" class="upload<?php if ($_POST['type'] != 'local'): ?> hide<?php endif; ?>">
								<table class="form">
								<tr>
									<td class="name w130"><?php echo $this->_tpl_vars['lang']['file']; ?>
:</td>
									<td class="field">
										<input class="file" type="file" name="video" />
										<table>
										<tr>
											<td><?php echo $this->_tpl_vars['lang']['max_file_size']; ?>
:</td>
											<td><b><em><?php echo $this->_tpl_vars['max_file_size']; ?>
</em></b></td>
										</tr>
										<tr>
											<td><?php echo $this->_tpl_vars['lang']['available_file_type']; ?>
:</td>
											<td>
												<?php $_from = $this->_tpl_vars['l_player_file_types']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['file_typesF'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['file_typesF']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['f_type'] => $this->_tpl_vars['item']):
        $this->_foreach['file_typesF']['iteration']++;
?>
												<b><em><?php echo $this->_tpl_vars['f_type']; ?>
</em></b><?php if (! ($this->_foreach['file_typesF']['iteration'] == $this->_foreach['file_typesF']['total'])): ?>,<?php endif; ?>
												<?php endforeach; endif; unset($_from); ?>
											</td>
										</tr>
										</table>
									</td>
								</tr>
								<tr>
									<td class="name w130"><?php echo $this->_tpl_vars['lang']['preview_image']; ?>
:</td>
									<td class="field">
										<input class="file" type="file" name="preview" />
									</td>
								</tr>
								<tr>
									<td></td>
									<td>
										<input class="button" type="submit" name="finish" value="<?php echo $this->_tpl_vars['lang']['upload']; ?>
" />
									</td>
								</tr>
								</table>
							</div>
							
							<div id="youtube_video" class="upload<?php if ($_POST['type'] != 'youtube'): ?> hide<?php endif; ?>">
								<table class="form">
								<tr>
									<td class="name w130"><?php echo $this->_tpl_vars['lang']['embed']; ?>
:</td>
									<td class="field">
										<textarea style="width: 500px; height: 80px;" cols="" rows="" name="youtube_embed"><?php echo $_POST['youtube_embed']; ?>
</textarea>
									</td>
								</tr>
								<tr>
									<td></td>
									<td>
										<input class="button" type="submit" name="finish" value="<?php echo $this->_tpl_vars['lang']['upload']; ?>
" />
									</td>
								</tr>
								</table>
							</div>
						</div>
					</form>
					</div>
				</div>
			</fieldset>
			<!-- file uploader end -->
	
			<style type="text/css">
			@import url("<?php echo @RL_LIBS_URL; ?>
jquery/fancybox/jquery.fancybox.css");
			</style>
			
			<script type="text/javascript" src="<?php echo @RL_LIBS_URL; ?>
player/flowplayer.js"></script>
			<script type="text/javascript" src="<?php echo @RL_LIBS_URL; ?>
jquery/jquery.fancybox.js"></script>
			
			<!-- video list -->
			<fieldset style="margin: 10px 0;">
				<legend id="legend_video_area" class="up" onclick="fieldset_action('video_area');"><?php echo $this->_tpl_vars['lang']['listing_video']; ?>
</legend>
				<div id="video_area" style="padding: 0 0 4px 10px;">
					<?php if (empty ( $this->_tpl_vars['videos'] )): ?>
						<div class="grey_middle"><?php echo $this->_tpl_vars['lang']['no_video_uploaded']; ?>
</div>
					<?php else: ?>
						<?php $this->assign('replace', ('{')."key".('}')); ?>
						<ul class="items" id="uploaded_video">
						<?php $_from = $this->_tpl_vars['videos']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['video']):
?>		
							<li id="video_<?php echo $this->_tpl_vars['video']['ID']; ?>
">
								<?php if ($this->_tpl_vars['video']['Type'] == 'local'): ?>
									<img class="peview_item" src="<?php echo @RL_FILES_URL; ?>
<?php echo $this->_tpl_vars['video']['Preview']; ?>
" alt="" />
								<?php else: ?>
									<img class="peview_item" src="<?php echo ((is_array($_tmp=$this->_tpl_vars['l_youtube_thumbnail'])) ? $this->_run_mod_handler('replace', true, $_tmp, $this->_tpl_vars['replace'], $this->_tpl_vars['video']['Preview']) : smarty_modifier_replace($_tmp, $this->_tpl_vars['replace'], $this->_tpl_vars['video']['Preview'])); ?>
" alt="" />
								<?php endif; ?>
								<img title="<?php echo $this->_tpl_vars['lang']['remove']; ?>
" src="<?php echo $this->_tpl_vars['rlTplBase']; ?>
img/blank.gif" id="remove_<?php echo $this->_tpl_vars['video']['ID']; ?>
" class="remove_item" alt="" />
								
								<script type="text/javascript">//<![CDATA[
								/* load video handler */
								<?php if ($this->_tpl_vars['video']['Type'] == 'local'): ?>
								<?php echo '
								
								$(\'#video_'; ?>
<?php echo $this->_tpl_vars['video']['ID']; ?>
<?php echo ' img.peview_item\').click(function(){
									$.fancybox({
										padding			: 0,
										autoScale		: false,
										transitionIn	: \'none\',
										transitionOut	: \'none\',
										width			: '; ?>
<?php echo $this->_tpl_vars['config']['video_width']; ?>
<?php echo ',
										height			: '; ?>
<?php echo $this->_tpl_vars['config']['video_height']; ?>
<?php echo ',
										content			: \'<a href="'; ?>
<?php echo @RL_FILES_URL; ?>
<?php echo $this->_tpl_vars['video']['Video']; ?>
<?php echo '" style="display:block;width:'; ?>
<?php echo $this->_tpl_vars['config']['video_width']; ?>
<?php echo 'px;height:'; ?>
<?php echo $this->_tpl_vars['config']['video_height']; ?>
<?php echo 'px;" id="player"></a>\',
										onComplete:		function(){
											flowplayer(\'player\', {src: \''; ?>
<?php echo @RL_LIBS_URL; ?>
<?php echo 'player/flowplayer-3.2.7.swf\', wmode: \'transparent\'});
										},
										onClosed:		function(){
											$f().stop();
										}
									});
								});
								
								'; ?>

								<?php else: ?>
								<?php echo '
								
								$(\'#video_'; ?>
<?php echo $this->_tpl_vars['video']['ID']; ?>
<?php echo ' img.peview_item\').click(function(){
									$.fancybox({
										padding			: 0,
										autoScale		: false,
										transitionIn	: \'none\',
										transitionOut	: \'none\',
										width			: '; ?>
<?php echo $this->_tpl_vars['config']['video_width']; ?>
<?php echo ',
										height			: '; ?>
<?php echo $this->_tpl_vars['config']['video_height']; ?>
<?php echo ',
										href			: \''; ?>
<?php echo ((is_array($_tmp=$this->_tpl_vars['l_youtube_direct'])) ? $this->_run_mod_handler('replace', true, $_tmp, $this->_tpl_vars['replace'], $this->_tpl_vars['video']['Preview']) : smarty_modifier_replace($_tmp, $this->_tpl_vars['replace'], $this->_tpl_vars['video']['Preview'])); ?>
<?php echo '\',
										type			: \'swf\',
										swf				: {
											wmode		: \'transparent\',
											allowfullscreen	: true
										}
									});
								});
								
								'; ?>

								<?php endif; ?>
								//]]>
								</script>
							</li>
						<?php endforeach; endif; unset($_from); ?>
						</ul>
					<?php endif; ?>
				</div>
			</fieldset>
			<!-- video list end -->
			
			<?php echo rlHook::load(array('name' => 'apTplListingsVideo'), $this);?>

			
			<script type="text/javascript">//<![CDATA[
			var video_listing_id = <?php echo $this->_tpl_vars['listing']['ID']; ?>
;
			var sort_save = false;
			<?php echo '
					
			$(\'div#video_area ul.items\').sortable({
				placeholder: \'hover\',
				stop: function(event, obj){
					/* save sorting */
					var sort = \'\';
					var count = 0;
					$(\'div#video_area ul.items li\').each(function(){
						var id = $(this).attr(\'id\').split(\'_\')[1];
						count++;
						var pos = $(\'div#video_area ul.items li\').index($(this))+1;
						sort += id+\',\'+pos+\';\';
					});
					
					if ( sort.length > 0 && count > 1 && sort_save != sort )
					{
						sort_save = sort;
						sort = rtrim(sort, \';\');
						xajax_reorderVideo(video_listing_id, sort);
					}
				}
			});
					
			$(document).ready(function(){
				$(\'#type_selector\').change(function(){
					var id = $(this).val().split(\'_\')[0];
					$(\'div.upload\').slideUp();
					$(\'div#\'+id+\'_video\').slideDown(\'slow\');
				});
				
				$(\'img.remove_item\').click(function(){
					rlConfirm("'; ?>
<?php echo $this->_tpl_vars['lang']['delete_confirm']; ?>
<?php echo '", \'xajax_deleteVideo\', $(this).attr(\'id\').split(\'_\')[1]);
				});
			});
			
			'; ?>

			//]]>
			</script>
			
			<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_end.tpl') : smarty_modifier_cat($_tmp, 'm_block_end.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
			
		<?php endif; ?>
	
		<!-- add listing video end -->
		
	<?php elseif ($_GET['action'] == 'view'): ?>
		<style type="text/css">
		@import url("<?php echo @RL_LIBS_URL; ?>
jquery/fancybox/jquery.fancybox.css");
		</style>
			
		<script type="text/javascript" src="<?php echo @RL_LIBS_URL; ?>
player/flowplayer.js"></script>
		<script type="text/javascript" src="<?php echo @RL_LIBS_URL; ?>
jquery/jquery.fancybox.js"></script>
	
		<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_start.tpl') : smarty_modifier_cat($_tmp, 'm_block_start.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
	
		<ul class="tabs">
			<?php $_from = $this->_tpl_vars['tabs']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['tabsF'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['tabsF']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['tab']):
        $this->_foreach['tabsF']['iteration']++;
?>
			<li lang="<?php echo $this->_tpl_vars['tab']['key']; ?>
" <?php if (($this->_foreach['tabsF']['iteration'] <= 1)): ?>class="active"<?php endif; ?>><?php echo $this->_tpl_vars['tab']['name']; ?>
</li>
			<?php endforeach; endif; unset($_from); ?>
		</ul>
		
		<div class="tab_area listing listing_details">
			<table class="sTable">
			<tr>
				<td class="sidebar">
					<?php if ($this->_tpl_vars['photos']): ?>
						<ul class="media">
						<?php $_from = $this->_tpl_vars['photos']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['photosF'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['photosF']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['photo']):
        $this->_foreach['photosF']['iteration']++;
?>
							<li <?php if ($this->_foreach['photosF']['iteration']%2 != 0): ?>class="nl"<?php endif; ?>>
								<a title="<?php echo $this->_tpl_vars['photo']['Description']; ?>
" rel="group" href="<?php echo @RL_URL_HOME; ?>
files/<?php echo $this->_tpl_vars['photo']['Photo']; ?>
"><img alt="" class="shadow" src="<?php echo @RL_URL_HOME; ?>
files/<?php echo $this->_tpl_vars['photo']['Thumbnail']; ?>
" /></a>
							</li>
						<?php endforeach; endif; unset($_from); ?>
						</ul>
					<?php endif; ?>
					
					<ul class="statistics">
						<?php echo rlHook::load(array('name' => 'apTplListingBeforeStats'), $this);?>

					
						<li><span class="name"><?php echo $this->_tpl_vars['lang']['category']; ?>
:</span> <a href="<?php echo $this->_tpl_vars['rlBase']; ?>
index.php?controller=browse&amp;id=<?php echo $this->_tpl_vars['listing_data']['Category_ID']; ?>
" target="_blank"><?php echo $this->_tpl_vars['listing_data']['category_name']; ?>
</a></li>
						<?php if ($this->_tpl_vars['config']['count_listing_visits']): ?><li><span class="name"><?php echo $this->_tpl_vars['lang']['shows']; ?>
:</span> <?php echo $this->_tpl_vars['listing_data']['Shows']; ?>
</li><?php endif; ?>
						<?php if ($this->_tpl_vars['config']['display_posted_date']): ?><li><span class="name"><?php echo $this->_tpl_vars['lang']['posted']; ?>
:</span> <?php echo ((is_array($_tmp=$this->_tpl_vars['listing_data']['Date'])) ? $this->_run_mod_handler('date_format', true, $_tmp, @RL_DATE_FORMAT) : smarty_modifier_date_format($_tmp, @RL_DATE_FORMAT)); ?>
</li><?php endif; ?>
						
						<?php echo rlHook::load(array('name' => 'apTplListingAfterStats'), $this);?>

					</ul>
				</td>
				<td valign="top">
					<!-- listing info -->
					<?php echo rlHook::load(array('name' => 'apListingDetailsPreFields'), $this);?>

					
					<?php $_from = $this->_tpl_vars['listing']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['group']):
?>
						<?php if ($this->_tpl_vars['group']['Group_ID']): ?>
							<?php $this->assign('hide', true); ?>
							<?php if ($this->_tpl_vars['group']['Fields'] && $this->_tpl_vars['group']['Display']): ?>
								<?php $this->assign('hide', false); ?>
							<?php endif; ?>
					
							<?php $this->assign('value_counter', '0'); ?>
							<?php $_from = $this->_tpl_vars['group']['Fields']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['groupsF'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['groupsF']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['group_values']):
        $this->_foreach['groupsF']['iteration']++;
?>
								<?php if ($this->_tpl_vars['group_values']['value'] == '' || ! $this->_tpl_vars['group_values']['Details_page']): ?>
									<?php $this->assign('value_counter', $this->_tpl_vars['value_counter']+1); ?>
								<?php endif; ?>
							<?php endforeach; endif; unset($_from); ?>
					
							<?php if (! empty ( $this->_tpl_vars['group']['Fields'] ) && ( $this->_foreach['groupsF']['total'] != $this->_tpl_vars['value_counter'] )): ?>
								<fieldset class="light">
									<legend id="legend_group_<?php echo $this->_tpl_vars['group']['ID']; ?>
" class="up" onclick="fieldset_action('group_<?php echo $this->_tpl_vars['group']['ID']; ?>
');"><?php echo $this->_tpl_vars['group']['name']; ?>
</legend>
									<div id="group_<?php echo $this->_tpl_vars['group']['ID']; ?>
" class="tree">
								
										<table class="list">
										<?php $_from = $this->_tpl_vars['group']['Fields']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['fListings'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['fListings']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['field'] => $this->_tpl_vars['item']):
        $this->_foreach['fListings']['iteration']++;
?>
											<?php if (! empty ( $this->_tpl_vars['item']['value'] ) && $this->_tpl_vars['item']['Details_page']): ?>
											<tr id="df_field_<?php echo $this->_tpl_vars['item']['Key']; ?>
">
												<td class="name"><?php echo $this->_tpl_vars['item']['name']; ?>
:</td>
												<td class="value <?php if (($this->_foreach['fListings']['iteration'] <= 1)): ?>first<?php endif; ?>">
												<?php if ($this->_tpl_vars['item']['Opt1']): ?>
													<?php if ($this->_tpl_vars['item']['Opt2']): ?>
														<?php $this->assign('col_num', $this->_tpl_vars['item']['Opt2']); ?>
													<?php else: ?>
														<?php $this->assign('col_num', 3); ?>
													<?php endif; ?>
													<table class="checkboxes<?php if ($this->_tpl_vars['col_num'] > 2): ?> fixed<?php endif; ?>">
													<tr>
													<?php $_from = $this->_tpl_vars['item']['Values']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['checkboxF'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['checkboxF']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['tile']):
        $this->_foreach['checkboxF']['iteration']++;
?>
														<td><div class="<?php if (((is_array($_tmp=$this->_tpl_vars['tile']['ID'])) ? $this->_run_mod_handler('in_array', true, $_tmp, $this->_tpl_vars['item']['source']) : in_array($_tmp, $this->_tpl_vars['item']['source']))): ?>checkbox_active<?php else: ?>checkbox<?php endif; ?>"><?php echo $this->_tpl_vars['lang'][$this->_tpl_vars['tile']['pName']]; ?>
</div></td>
														<?php if ($this->_foreach['checkboxF']['iteration']%$this->_tpl_vars['col_num'] == 0 && ! ($this->_foreach['checkboxF']['iteration'] == $this->_foreach['checkboxF']['total'])): ?>
														</tr>
														<tr>
														<?php endif; ?>
													<?php endforeach; endif; unset($_from); ?>
													</tr>
													</table>
												<?php else: ?>
													<?php echo $this->_tpl_vars['item']['value']; ?>

												<?php endif; ?>
												</td>
											</tr>
											<?php endif; ?>
										<?php endforeach; endif; unset($_from); ?>
										</table>
								
									</div>
								</fieldset>
							<?php endif; ?>
						<?php else: ?>
							<?php if ($this->_tpl_vars['group']['Fields']): ?>
								<table class="list">
								<?php $this->assign('item', $this->_tpl_vars['group']['Fields']['0']); ?>
								<?php if (! empty ( $this->_tpl_vars['item']['value'] ) && $this->_tpl_vars['item']['Details_page']): ?>
								<tr id="df_field_<?php echo $this->_tpl_vars['item']['Key']; ?>
">
									<td class="name"><?php echo $this->_tpl_vars['item']['name']; ?>
:</td>
									<td class="value"><?php echo $this->_tpl_vars['item']['value']; ?>
</td>
								</tr>
								<?php endif; ?>
								</table>
							<?php endif; ?>
						<?php endif; ?>
					<?php endforeach; endif; unset($_from); ?>
					<!-- listing info end -->
				</td>
			</tr>
			</table>
			
			<script type="text/javascript">
			<?php echo '
			
			$(document).ready(function(){
				$(\'ul.media a\').fancybox({
					titlePosition: \'over\',
					centerOnScroll: true,
					scrolling: \'yes\'
				});
			});
			
			'; ?>

			</script>
		</div>
		
		<div class="tab_area seller listing_details hide">
			<table class="sTatic">
			<tr>
				<td valign="top" style="width: 170px;text-align: right;padding-right: 20px;">
					<a title="<?php echo $this->_tpl_vars['lang']['visit_owner_page']; ?>
" href="<?php echo $this->_tpl_vars['rlBase']; ?>
index.php?controller=accounts&amp;action=view&amp;userid=<?php echo $this->_tpl_vars['seller_info']['ID']; ?>
">
						<img style="display: inline;" <?php if (! empty ( $this->_tpl_vars['seller_info']['Photo'] )): ?>class="thumbnail"<?php endif; ?> alt="<?php echo $this->_tpl_vars['lang']['seller_thumbnail']; ?>
" src="<?php if (! empty ( $this->_tpl_vars['seller_info']['Photo'] )): ?><?php echo @RL_URL_HOME; ?>
files/<?php echo $this->_tpl_vars['seller_info']['Photo']; ?>
<?php else: ?><?php echo $this->_tpl_vars['rlTplBase']; ?>
img/no-account.png<?php endif; ?>" />
					</a>
	
					<ul class="info">
						<?php if ($this->_tpl_vars['config']['messages_module']): ?><li><input id="contact_owner" type="button" value="<?php echo $this->_tpl_vars['lang']['contact_owner']; ?>
" /></li><?php endif; ?>
						<?php if ($this->_tpl_vars['seller_info']['Own_page']): ?>
							<li><a target="_blank" title="<?php echo $this->_tpl_vars['lang']['visit_owner_page']; ?>
" href="<?php echo $this->_tpl_vars['seller_info']['Personal_address']; ?>
"><?php echo $this->_tpl_vars['lang']['visit_owner_page']; ?>
</a></li>
							<li><a title="<?php echo $this->_tpl_vars['lang']['other_owner_listings']; ?>
" href="<?php echo $this->_tpl_vars['rlBase']; ?>
index.php?controller=accounts&amp;action=view&amp;userid=<?php echo $this->_tpl_vars['seller_info']['ID']; ?>
#listings"><?php echo $this->_tpl_vars['lang']['other_owner_listings']; ?>
</a> <span class="counter">(<?php echo $this->_tpl_vars['seller_info']['Listings_count']; ?>
)</span></li>
						<?php endif; ?>
					</ul>
				</td>
				<td valign="top">
					<div class="username"><?php echo $this->_tpl_vars['seller_info']['Full_name']; ?>
</div>
					<?php if ($this->_tpl_vars['seller_info']['Fields']): ?>
						<table class="list" style="margin-bottom: 20px;">
							<tr id="si_field_username">
								<td class="name"><?php echo $this->_tpl_vars['lang']['username']; ?>
:</td>
								<td class="value first"><?php echo $this->_tpl_vars['seller_info']['Username']; ?>
</td>
							</tr>
							<tr id="si_field_date">
								<td class="name"><?php echo $this->_tpl_vars['lang']['join_date']; ?>
:</td>
								<td class="value"><?php echo ((is_array($_tmp=$this->_tpl_vars['seller_info']['Date'])) ? $this->_run_mod_handler('date_format', true, $_tmp, @RL_DATE_FORMAT) : smarty_modifier_date_format($_tmp, @RL_DATE_FORMAT)); ?>
</td>
							</tr>
							<tr id="si_field_email">
								<td class="name"><?php echo $this->_tpl_vars['lang']['mail']; ?>
:</td>
								<td class="value"><a href="mailto:<?php echo $this->_tpl_vars['seller_info']['Mail']; ?>
"><?php echo $this->_tpl_vars['seller_info']['Mail']; ?>
</a></td>
							</tr>
							<tr id="si_field_personal_address">
								<td class="name"><?php echo $this->_tpl_vars['lang']['personal_address']; ?>
:</td>
								<td class="value"><a target="_blank" href="<?php echo $this->_tpl_vars['seller_info']['Personal_address']; ?>
"><?php echo $this->_tpl_vars['seller_info']['Personal_address']; ?>
</a></td>
							</tr>
							
							<?php echo rlHook::load(array('name' => 'apTplListingsUserInfo'), $this);?>

						</table>
						
						<table class="list">
						<?php $_from = $this->_tpl_vars['seller_info']['Fields']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['sellerF'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['sellerF']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['item']):
        $this->_foreach['sellerF']['iteration']++;
?>
							<?php if (! empty ( $this->_tpl_vars['item']['value'] )): ?>
							<tr id="si_field_<?php echo $this->_tpl_vars['item']['Key']; ?>
">
								<td class="name"><?php echo $this->_tpl_vars['item']['name']; ?>
:</td>
								<td class="value"><?php echo $this->_tpl_vars['item']['value']; ?>
</td>
							</tr>
							<?php endif; ?>
						<?php endforeach; endif; unset($_from); ?>
						</table>
					<?php endif; ?>
				</td>
			</tr>
			</table>
			
			<script type="text/javascript">
			var owner_id = <?php if ($this->_tpl_vars['seller_info']['ID']): ?><?php echo $this->_tpl_vars['seller_info']['ID']; ?>
<?php else: ?>false<?php endif; ?>
			<?php echo '
			
			$(document).ready(function(){
				$(\'#contact_owner\').click(function(){
					rlPrompt(\''; ?>
<?php echo $this->_tpl_vars['lang']['contact_owner']; ?>
<?php echo '\', \'xajax_contactOwner\', owner_id, true);
				});
			});
			
			'; ?>

			</script>
		</div>
		
		<?php if ($this->_tpl_vars['videos']): ?>
		<div class="tab_area video listing_details hide">
			<?php $this->assign('replace', ('{')."key".('}')); ?>
			<ul class="media">
			<?php $_from = $this->_tpl_vars['videos']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['video']):
?>
				<li id="video_<?php echo $this->_tpl_vars['video']['ID']; ?>
">
					<?php if ($this->_tpl_vars['video']['Type'] == 'local'): ?>
						<img src="<?php echo @RL_FILES_URL; ?>
<?php echo $this->_tpl_vars['video']['Embed']; ?>
" alt="" />
					<?php else: ?>
						<img src="<?php echo ((is_array($_tmp=$this->_tpl_vars['l_youtube_thumbnail'])) ? $this->_run_mod_handler('replace', true, $_tmp, $this->_tpl_vars['replace'], $this->_tpl_vars['video']['Preview']) : smarty_modifier_replace($_tmp, $this->_tpl_vars['replace'], $this->_tpl_vars['video']['Preview'])); ?>
" alt="" />
					<?php endif; ?>
					
					<script type="text/javascript">//<![CDATA[
					<?php if ($this->_tpl_vars['video']['Type'] == 'local'): ?>
					<?php echo '
					
					$(\'#video_'; ?>
<?php echo $this->_tpl_vars['video']['ID']; ?>
<?php echo ' img\').click(function(){
						$.fancybox({
							padding			: 0,
							autoScale		: false,
							transitionIn	: \'none\',
							transitionOut	: \'none\',
							width			: '; ?>
<?php echo $this->_tpl_vars['config']['video_width']; ?>
<?php echo ',
							height			: '; ?>
<?php echo $this->_tpl_vars['config']['video_height']; ?>
<?php echo ',
							content			: \'<a href="'; ?>
<?php echo @RL_FILES_URL; ?>
<?php echo $this->_tpl_vars['video']['Video']; ?>
<?php echo '" style="display:block;width:'; ?>
<?php echo $this->_tpl_vars['config']['video_width']; ?>
<?php echo 'px;height:'; ?>
<?php echo $this->_tpl_vars['config']['video_height']; ?>
<?php echo 'px;" id="player"></a>\',
							onComplete:		function(){
								flowplayer(\'player\', {src: \''; ?>
<?php echo @RL_LIBS_URL; ?>
<?php echo 'player/flowplayer-3.2.7.swf\', wmode: \'transparent\'});
							},
							onClosed:		function(){
								$f().stop();
							}
						});
					});
					
					'; ?>

					<?php else: ?>
					<?php echo '
					
					$(\'#video_'; ?>
<?php echo $this->_tpl_vars['video']['ID']; ?>
<?php echo ' img\').click(function(){
						$.fancybox({
							padding			: 0,
							autoScale		: false,
							transitionIn	: \'none\',
							transitionOut	: \'none\',
							width			: '; ?>
<?php echo $this->_tpl_vars['config']['video_width']; ?>
<?php echo ',
							height			: '; ?>
<?php echo $this->_tpl_vars['config']['video_height']; ?>
<?php echo ',
							href			: \''; ?>
<?php echo ((is_array($_tmp=$this->_tpl_vars['l_youtube_direct'])) ? $this->_run_mod_handler('replace', true, $_tmp, $this->_tpl_vars['replace'], $this->_tpl_vars['video']['Preview']) : smarty_modifier_replace($_tmp, $this->_tpl_vars['replace'], $this->_tpl_vars['video']['Preview'])); ?>
<?php echo '\',
							type			: \'swf\',
							swf				: {
								wmode		: \'transparent\',
								allowfullscreen	: true
							}
						});
					});
					
					'; ?>

					<?php endif; ?>
					//]]>
					</script>
				</li>
			<?php endforeach; endif; unset($_from); ?>
			</ul>
		</div>
		<?php endif; ?>
		
		<div class="tab_area map listing_details hide">
			<div id="map" style="width: <?php if (empty ( $this->_tpl_vars['config']['map_width'] )): ?>100%<?php else: ?><?php echo $this->_tpl_vars['config']['map_width']; ?>
px<?php endif; ?>; height: <?php if (empty ( $this->_tpl_vars['config']['map_height'] )): ?>300px<?php else: ?><?php echo $this->_tpl_vars['config']['map_height']; ?>
px<?php endif; ?>"></div>
				
			<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false<?php if (@RL_LANG_CODE != '' && @RL_LANG_CODE != 'en'): ?>&amp;language=<?php echo @RL_LANG_CODE; ?>
<?php endif; ?>"></script>
			<script type="text/javascript" src="http://www.google.com/uds/api?file=uds.js&amp;v=1.0&amp;key=<?php echo $this->_tpl_vars['config']['google_map_key']; ?>
"></script>
			<script type="text/javascript" src="<?php echo @RL_LIBS_URL; ?>
jquery/jquery.flmap.js"></script>
			<script type="text/javascript">//<![CDATA[
			<?php echo '
			
			var map_exist = false;
			$(document).ready(function(){
				$(\'ul.tabs li[lang=map]\').click(function(){
					if ( !map_exist )
					{
						$(\'#map\').flMap({
							addresses: [
								['; ?>
'<?php if ($this->_tpl_vars['location']['direct']): ?><?php echo $this->_tpl_vars['location']['direct']; ?>
<?php else: ?><?php echo $this->_tpl_vars['location']['search']; ?>
<?php endif; ?>', '<?php echo $this->_tpl_vars['location']['show']; ?>
', '<?php if ($this->_tpl_vars['location']['direct']): ?>direct<?php else: ?>geocoder<?php endif; ?>'<?php echo ']
								//[\'Tamiami, FL\', \'Tamiami!\', \'geocoder\']
								//[\'-25.363882,131.044922\', \'Direct\']
							],
							phrases: {
								hide: \''; ?>
<?php echo $this->_tpl_vars['lang']['hide']; ?>
<?php echo '\',
								show: \''; ?>
<?php echo $this->_tpl_vars['lang']['show']; ?>
<?php echo '\',
								notFound: \''; ?>
<?php echo $this->_tpl_vars['lang']['location_not_found']; ?>
<?php echo '\'
							},
							zoom: '; ?>
<?php echo $this->_tpl_vars['config']['map_default_zoom']; ?>
<?php if ($this->_tpl_vars['config']['map_amenities'] && $this->_tpl_vars['amenities']): ?>,<?php echo '
							localSearch: {
								caption: \''; ?>
<?php echo $this->_tpl_vars['lang']['local_amenity']; ?>
<?php echo '\',
								services: ['; ?>

									<?php $_from = $this->_tpl_vars['amenities']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['amenityF'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['amenityF']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['amenity']):
        $this->_foreach['amenityF']['iteration']++;
?>
									['<?php echo $this->_tpl_vars['amenity']['Key']; ?>
', '<?php echo $this->_tpl_vars['amenity']['name']; ?>
', <?php if ($this->_tpl_vars['amenity']['Default']): ?>'checked'<?php else: ?>false<?php endif; ?>]<?php if (! ($this->_foreach['amenityF']['iteration'] == $this->_foreach['amenityF']['total'])): ?>,<?php endif; ?>
									<?php endforeach; endif; unset($_from); ?>
								<?php echo ']
							}
							'; ?>
<?php endif; ?><?php echo '
						});
						map_exist = true;
					}
				});
			});
			
			'; ?>

			//]]>
			</script>
		</div>
		
		<?php echo rlHook::load(array('name' => 'apTplListingsTabsArea'), $this);?>

	
		<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_end.tpl') : smarty_modifier_cat($_tmp, 'm_block_end.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
	<?php else: ?>
	
		<script type="text/javascript">//<![CDATA[
		// collect plans
		var listing_plans = [
			<?php $_from = $this->_tpl_vars['plans']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['plans_f'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['plans_f']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['plan']):
        $this->_foreach['plans_f']['iteration']++;
?>
				['<?php echo $this->_tpl_vars['plan']['ID']; ?>
', '<?php echo $this->_tpl_vars['plan']['name']; ?>
']<?php if (! ($this->_foreach['plans_f']['iteration'] == $this->_foreach['plans_f']['total'])): ?>,<?php endif; ?>
			<?php endforeach; endif; unset($_from); ?>
		];
		
		var ui = typeof( rl_ui ) != 'undefined' ? '&ui='+rl_ui : '';
		var ui_cat_id = typeof( cur_cat_id ) != 'undefined' ? '&cat_id='+cur_cat_id : '';
		
		/* read cookies filters */
		var cookies_filters = false;
		
		if ( readCookie('listings_sc') )
			cookies_filters = readCookie('listings_sc').split(',');
		
		<?php if (isset ( $this->_tpl_vars['status'] )): ?>
			cookies_filters = new Array();
			cookies_filters[0] = new Array('Status', '<?php echo $this->_tpl_vars['status']; ?>
');
		<?php endif; ?>
		
		<?php if ($_GET['username']): ?>
			cookies_filters = new Array();
			cookies_filters[0] = new Array('Account', '<?php echo $_GET['username']; ?>
');
		<?php endif; ?>
		
		<?php if ($_GET['account_type']): ?>
			cookies_filters = new Array();
			cookies_filters[0] = new Array('account_type', '<?php echo $_GET['account_type']; ?>
');
		<?php endif; ?>
		
		<?php if ($_GET['listing_type']): ?>
			cookies_filters = new Array();
			cookies_filters[0] = new Array('Type', '<?php echo $_GET['listing_type']; ?>
');
		<?php endif; ?>
		
		<?php if ($_GET['plan_id']): ?>
			cookies_filters = new Array();
			cookies_filters[0] = new Array('Plan_ID', '<?php echo $_GET['plan_id']; ?>
');
		<?php endif; ?>
		
		<?php echo rlHook::load(array('name' => 'apTplListingsRemoteFilter'), $this);?>

		
		//]]>
		</script>
		
		<!-- listings grid create -->
		<div id="grid"></div>
		<script type="text/javascript">//<![CDATA[
		var mass_actions = [
			[lang['ext_activate'], 'activate'],
			[lang['ext_suspend'], 'approve'],
			<?php if (((is_array($_tmp='delete')) ? $this->_run_mod_handler('in_array', true, $_tmp, $this->_tpl_vars['aRights']['listings']) : in_array($_tmp, $this->_tpl_vars['aRights']['listings']))): ?>[lang['ext_delete'], 'delete'],<?php endif; ?>
			[lang['ext_move'], 'move'],
			[lang['ext_make_featured'], 'featured'],
			[lang['ext_annul_featured'], 'annul_featured']
		];
		
		<?php echo '
		
		var listingsGrid;
		$(document).ready(function(){
	
			listingsGrid = new gridObj({
				key: \'listings\',
				id: \'grid\',
				ajaxUrl: rlUrlHome + \'controllers/listings.inc.php?q=ext\',
				defaultSortField: \'Date\',
				defaultSortType: \'DESC\',
				remoteSortable: false,
				checkbox: true,
				actions: mass_actions,
				filters: cookies_filters,
				filtersPrefix: true,
				title: lang[\'ext_listings_manager\'],
				expander: true,
				expanderTpl: \'<div style="margin: 0 5px 5px 83px"> \\
					<table> \\
					<tr> \\
					<td>{thumbnail}</td> \\
					<td>{fields}</td> \\
					</tr> \\
					</table> \\
					<div> \\
				\',
				affectedObjects: \'#make_featured,#move_area\',
				fields: [
					{name: \'ID\', mapping: \'ID\', type: \'int\'},
					{name: \'title\', mapping: \'title\', type: \'string\'},
					{name: \'Username\', mapping: \'Username\', type: \'string\'},
					{name: \'Account_ID\', mapping: \'Account_ID\', type: \'int\'},
					{name: \'Type\', mapping: \'Type\'},
					{name: \'Type_key\', mapping: \'Type_key\'},
					{name: \'Plan_name\', mapping: \'Plan_name\'},
					{name: \'Plan_ID\', mapping: \'Plan_name\'},
					{name: \'Plan_info\', mapping: \'Plan_info\'},
					{name: \'Cat_title\', mapping: \'Cat_title\', type: \'string\'},
					{name: \'Cat_ID\', mapping: \'Cat_ID\', type: \'int\'},
					{name: \'Cat_custom\', mapping: \'Cat_custom\', type: \'int\'},
					{name: \'Status\', mapping: \'Status\'},
					{name: \'Date\', mapping: \'Date\', type: \'date\', dateFormat: \'Y-m-d H:i:s\'},
					{name: \'Pay_date\', mapping: \'Pay_date\', type: \'date\', dateFormat: \'Y-m-d H:i:s\'},
					{name: \'thumbnail\', mapping: \'thumbnail\', type: \'string\'},
					{name: \'fields\', mapping: \'fields\', type: \'string\'},
					{name: \'data\', mapping: \'data\', type: \'string\'},
					{name: \'Allow_photo\', mapping: \'Allow_photo\', type: \'int\'},
					{name: \'Allow_video\', mapping: \'Allow_video\', type: \'int\'}
				],
				columns: [
					{
						header: lang[\'ext_id\'],
						dataIndex: \'ID\',
						width: 40,
						fixed: true,
						id: \'rlExt_black_bold\'
					},{
						header: lang[\'ext_title\'],
						dataIndex: \'title\',
						width: 23,
						renderer: function(val, ext, row){
							var out = \'<a href="\'+rlUrlHome+\'index.php?controller=listings&action=view&id=\'+row.data.ID+\'">\'+val+\'</a>\';
							return out;
						}
					},{
						header: lang[\'ext_owner\'],
						dataIndex: \'Username\',
						width: 8,
						id: \'rlExt_item_bold\',
						renderer: function(username, ext, row){
							return "<a target=\'_blank\' ext:qtip=\'"+lang[\'ext_click_to_view_details\']+"\' href=\'"+rlUrlHome+"index.php?controller=accounts&action=view&userid="+row.data.Account_ID+"\'>"+username+"</a>"
						}
					},{
						header: lang[\'ext_type\'],
						dataIndex: \'Type\',
						width: 8/*,
						renderer: function(val, obj, row){
							var out = \'<a target="_blank" ext:qtip="\'+lang[\'ext_click_to_view_details\']+\'" href="\'+rlUrlHome+\'index.php?controller=listing_types&action=edit&key=\'+row.data.Type_key+\'">\'+val+\'</a>\';
							return out;
						}*/
					},{
						header: lang[\'ext_category\'],
						dataIndex: \'Cat_title\',
						width: 9/*,
						renderer: function(val, obj, row){
							var link = row.data.Cat_custom ? rlUrlHome+\'index.php?controller=custom_categories\' : rlUrlHome+\'index.php?controller=browse&id=\'+row.data.Cat_ID;
							var out = \'<a target="_blank" ext:qtip="\'+lang[\'ext_click_to_view_details\']+\'" href="\'+link+\'">\'+val+\'</a>\';
							return out;
						}*/
					},{
						header: lang[\'ext_add_date\'],
						dataIndex: \'Date\',
						width: 10,
						hidden: true,
						renderer: Ext.util.Format.dateRenderer(rlDateFormat.replace(/%/g, \'\').replace(\'b\', \'M\'))
					},{
						header: lang[\'ext_payed\'],
						dataIndex: \'Pay_date\',
						width: 8,
						renderer: function(val){
							if (!val)
							{
								var date = \'<span class="delete" ext:qtip="\'+lang[\'ext_click_to_set_pay\']+\'">\'+lang[\'ext_not_payed\']+\'</span>\';
							}
							else
							{
								var date = Ext.util.Format.dateRenderer(rlDateFormat.replace(/%/g, \'\').replace(\'b\', \'M\'))(val);
								date = \'<span class="build" ext:qtip="\'+lang[\'ext_click_to_edit\']+\'">\'+date+\'</span>\';
							}
							return date;
						},
						editor: new Ext.form.DateField({
							format: \'Y-m-d H:i:s\'
						})
					},{
						header: lang[\'ext_plan\'],
						dataIndex: \'Plan_ID\',
						width: 11,
						editor: new Ext.form.ComboBox({
							store: listing_plans,
							mode: \'local\',
							triggerAction: \'all\'
						}),
						renderer: function (val, obj, row){
							if (val != \'\')
							{
								return \'<img class="info" ext:qtip="\'+row.data.Plan_info+\'" alt="" src="\'+rlUrlHome+\'img/blank.gif" />&nbsp;&nbsp;<span ext:qtip="\'+lang[\'ext_click_to_edit\']+\'">\'+val+\'</span>\';
							}
							else
							{
								return \'<span class="delete" ext:qtip="\'+lang[\'ext_click_to_edit\']+\'" style="margin-left: 21px;">\'+lang[\'ext_no_plan_set\']+\'</span>\';
							}
						}
					},{
						header: lang[\'ext_status\'],
						dataIndex: \'Status\',
						width: 5,
						editor: new Ext.form.ComboBox({
							store: [
								[\'active\', lang[\'ext_active\']],
								[\'approval\', lang[\'ext_approval\']]
							],
							mode: \'local\',
							typeAhead: true,
							triggerAction: \'all\',
							selectOnFocus: true
						}),
						renderer: function(val) {
							return \'<div ext:qtip="\'+lang[\'ext_click_to_edit\']+\'">\'+val+\'</div>\';
						}
					},{
						header: lang[\'ext_actions\'],
						width: 120,
						fixed: true,
						dataIndex: \'data\',
						sortable: false,
						resizeable: false,
						renderer: function(id, obj, row){
							var out = "<div style=\'text-align: right\'>";
							var splitter = false;
			
							if ( cKey == \'browse\' )
							{
								cKey = \'listings\';
							}
							
							if ( rights[cKey].indexOf(\'edit\') >= 0 )
							{
								if ( row.data.Allow_photo )
								{
									out += "<a href=\'"+rlUrlHome+"index.php?controller=listings&action=photos&id="+id+"\'><img class=\'photo\' ext:qtip=\'"+lang[\'ext_manage_photo\']+"\' src=\'"+rlUrlHome+"img/blank.gif\' /></a>";
								}
								if ( row.data.Allow_video )
								{
									out += "<a href=\'"+rlUrlHome+"index.php?controller=listings&action=video&id="+id+"\'><img class=\'video\' ext:qtip=\'"+lang[\'ext_manage_video\']+"\' src=\'"+rlUrlHome+"img/blank.gif\' /></a>";
								}
							}
							out += "<a href=\'"+rlUrlHome+"index.php?controller=listings&action=view&id="+id+"\'><img class=\'view\' ext:qtip=\'"+lang[\'ext_view_details\']+"\' src=\'"+rlUrlHome+"img/blank.gif\' /></a>";
							if ( rights[cKey].indexOf(\'edit\') >= 0 )
							{
								out += "<a href=\\""+rlUrlHome+"index.php?controller=listings&action=edit&id="+id+ui+ui_cat_id+"\\"><img class=\'edit\' ext:qtip=\'"+lang[\'ext_edit\']+"\' src=\'"+rlUrlHome+"img/blank.gif\' /></a>";
							}
							if ( rights[cKey].indexOf(\'delete\') >= 0 )
							{
								out += "<img class=\'remove\' ext:qtip=\'"+lang[\'ext_delete\']+"\' src=\'"+rlUrlHome+"img/blank.gif\' onClick=\'rlPrompt( \\""+lang[\'ext_notice_\'+delete_mod]+"\\",  \\"xajax_deleteListing\\", \\""+id+"\\" )\' />";
							}
							out += "</div>";
							
							return out;
						}
					}
				]
			});
			
			'; ?>
<?php echo rlHook::load(array('name' => 'apTplListingsGrid'), $this);?>
<?php echo '
			
			listingsGrid.init();
			grid.push(listingsGrid.grid);
			
			// actions listener
			listingsGrid.actionButton.addListener(\'click\', function()
			{
				var sel_obj = listingsGrid.checkboxColumn.getSelections();
				var action = listingsGrid.actionsDropDown.getValue();
	
				if (!action)
				{
					return false;
				}
				
				for( var i = 0; i < sel_obj.length; i++ )
				{
					listingsGrid.ids += sel_obj[i].id;
					if ( sel_obj.length != i+1 )
					{
						listingsGrid.ids += \'|\';
					}
				}
				
				switch (action){
					case \'delete\':
						Ext.MessageBox.confirm(\'Confirm\', lang[\'ext_notice_\'+delete_mod], function(btn){
							if ( btn == \'yes\' )
							{
								xajax_massActions( listingsGrid.ids, action );
								listingsGrid.store.reload();
							}
						});
						
						break;
					
					case \'featured\':
						$(\'#make_featured\').fadeIn(\'slow\');
						return false;
						
						break;
					
					case \'annul_featured\':
						$(\'#mass_areas div.scroll\').fadeOut(\'fast\');
						Ext.MessageBox.confirm(\'Confirm\', lang[\'ext_annul_featued_notice\'], function(btn){
							if ( btn == \'yes\' )
							{
								xajax_annulFeatured( listingsGrid.ids );
							}
						});
						return false;
						
					 	break;
					 	
					case \'move\':
						$(\'#mass_areas div.scroll\').fadeOut(\'fast\');
						$(\'#move_area\').fadeIn(\'slow\');
						return false;
						
						break;
					
					default:
						$(\'#make_featured,#move_area\').fadeOut(\'fast\');
						xajax_massActions( listingsGrid.ids, action );
						listingsGrid.store.reload();
					
						break;
				}
	
				listingsGrid.checkboxColumn.clearSelections();
				listingsGrid.actionsDropDown.setVisible(false);
				listingsGrid.actionButton.setVisible(false);
			});
			
			listingsGrid.grid.addListener(\'afteredit\', function(editEvent)
			{
				if ( editEvent.field == \'Plan_ID\' )
				{
					listingsGrid.reload();
				}
			});
			
		});
		'; ?>

		//]]>
		</script>
		
		<?php echo rlHook::load(array('name' => 'apTplListingsMiddle'), $this);?>

		
		<div id="mass_areas">
		
			<!-- make featured -->
			<div id="make_featured" style="margin-top: 10px;" class="hide scroll">
				
				<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_start.tpl') : smarty_modifier_cat($_tmp, 'm_block_start.tpl')), 'smarty_include_vars' => array('block_caption' => $this->_tpl_vars['lang']['make_featured'])));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
				<table class="form">
				<tr>
					<td class="name w130"><span class="red">*</span><?php echo $this->_tpl_vars['lang']['plan']; ?>
</td>
					<td class="field">
						<select id="featured_plan">
							<option value="0"><?php echo $this->_tpl_vars['lang']['select']; ?>
</option>
							<?php $_from = $this->_tpl_vars['featured_plans']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['featured_plan']):
?>
								<option value="<?php echo $this->_tpl_vars['featured_plan']['ID']; ?>
"><?php echo $this->_tpl_vars['featured_plan']['name']; ?>
</option>
							<?php endforeach; endif; unset($_from); ?>
						</select>
					</td>
				</tr>
				<tr>
					<td class="w130"></td>
					<td class="field">
						<input type="button" onclick="xajax_makeFeatured(listingsGrid.ids, $('#featured_plan').val());" value="<?php echo $this->_tpl_vars['lang']['save']; ?>
" />
						<a class="cancel" href="javascript:void(0)" onclick="$('#make_featured').fadeOut();"><?php echo $this->_tpl_vars['lang']['cancel']; ?>
</a>
					</td>
				</tr>
				</table>
				<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_end.tpl') : smarty_modifier_cat($_tmp, 'm_block_end.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
				
			</div>
			<!-- make featured end -->
			
			<!-- move listing block -->
				<div id="move_area" style="margin-top: 10px;" class="hide scroll">
				
				<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_start.tpl') : smarty_modifier_cat($_tmp, 'm_block_start.tpl')), 'smarty_include_vars' => array('block_caption' => $this->_tpl_vars['lang']['move_listings'])));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
				<table class="form">
				<tr>
					<td class="name w130"><span class="red">*</span><?php echo $this->_tpl_vars['lang']['category']; ?>
</td>
					<td class="field">
						<?php $_from = $this->_tpl_vars['sections']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['section']):
?>
							<fieldset class="light">
								<legend id="legend_move_<?php echo $this->_tpl_vars['section']['ID']; ?>
" class="up" onclick="fieldset_action('move_<?php echo $this->_tpl_vars['section']['ID']; ?>
');"><?php echo $this->_tpl_vars['section']['name']; ?>
</legend>
								<div id="move_<?php echo $this->_tpl_vars['section']['ID']; ?>
" class="tree">
									<?php if (! empty ( $this->_tpl_vars['section']['Categories'] )): ?>
										<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'category_level.tpl') : smarty_modifier_cat($_tmp, 'category_level.tpl')), 'smarty_include_vars' => array('categories' => $this->_tpl_vars['section']['Categories'],'first' => true,'postfix' => 'move')));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
									<?php else: ?>
										<div style="padding: 0 0 8px 10px;" class="blue_middle"><?php echo $this->_tpl_vars['lang']['no_items_in_sections']; ?>
</div>
									<?php endif; ?>
								</div>
							</fieldset>
						<?php endforeach; endif; unset($_from); ?>
					</td>
				</tr>
				<tr>
					<td class="w130"></td>
					<td class="field">
						<input type="button" onclick="xajax_moveListing(listingsGrid.ids, $('#move_cat_id').val());" value="<?php echo $this->_tpl_vars['lang']['move']; ?>
" />
						<a class="cancel" href="javascript:void(0)" onclick="$('#move_area').fadeOut();"><?php echo $this->_tpl_vars['lang']['cancel']; ?>
</a>
					</td>
				</tr>
				</table>
				<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_end.tpl') : smarty_modifier_cat($_tmp, 'm_block_end.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
				
				<script type="text/javascript">
				<?php echo '
				
				$(document).ready(function(){
					flynax.treeLoadLevel(\'\', \'\', \'div#move_area\');
				});
				
				function cat_chooser(id)
				{
					$(\'#move_cat_id\').val(id);
				}
				
				'; ?>

				</script>
				
				<input type="hidden" id="move_cat_id" value="" />
			</div>
			<!-- move listing block end -->
			
		</div>
		
		<?php echo rlHook::load(array('name' => 'apTplListingsBottom'), $this);?>

	
	<?php endif; ?>

<?php endif; ?>

<!-- listings tpl end -->